package com.mingliqiye.minecraft.enchantment.conflict.forge.network;

import com.mingliqiye.minecraft.enchantment.conflict.common.MinecraftMod;
import com.mingliqiye.minecraft.enchantment.conflict.forge.network.message.ConfigMessage;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.network.NetworkRegistry;
import net.minecraftforge.network.simple.SimpleChannel;

public class ChannelHander {

    private static final String PROTOCOL_VERSION = "2.0";
    public static final SimpleChannel CONFIG_CHANNEL_INSTANCE = NetworkRegistry.newSimpleChannel(
        new ResourceLocation(MinecraftMod.MOD_ID, "config_channel"),
        () -> PROTOCOL_VERSION,
        PROTOCOL_VERSION::equals,
        (v) -> true
    );
    public static final int CONFIG_SYNC = 0;

    public static void sendConfig(ServerPlayer player) {
        ConfigMessage.send(player);
    }

    public static void register() {
        ConfigMessage.register();
    }
}
